import { adminUrl, studentUrl } from "@/utils/baseUrl.js";
import request from "@/utils/request";

// 创建请假事由
export function createAttendanceLeaveReason(data) {
  return request({
    url: studentUrl + "/study/student/attendance/apply/leave",
    method: "post",
    data: data,
  });
}

// 更新请假事由
export function updateAttendanceLeaveReason(data) {
  return request({
    url: adminUrl + "/study/attendance-leave-reason/update",
    method: "put",
    data: data,
  });
}

// 删除请假事由
export function deleteAttendanceLeaveReason(id) {
  return request({
    url: adminUrl + "/study/attendance-leave-reason/delete?id=" + id,
    method: "delete",
  });
}

// 获得请假事由
export function getAttendanceLeaveReason(id) {
  return request({
    url: adminUrl + "/study/attendance-leave-reason/get?id=" + id,
    method: "get",
  });
}

// 获得请假事由分页
export function getAttendanceLeaveReasonPage(query) {
  return request({
    url: studentUrl + "/study/student/attendance/move/page",
    method: "get",
    params: query,
  });
}

// 导出请假事由 Excel
export function exportAttendanceLeaveReasonExcel(query) {
  return request({
    url: adminUrl + "/study/attendance-leave-reason/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}

//获取考勤详情
export function getAttendanceLeaveData(id) {
  return request({
    url: studentUrl + "/study/student/attendance/get?id=" + id,
    method: "get",
  });
}

//获取审批人列表
export function getStuentSendList(id) {
  return request({
    url: studentUrl + "/study/student/attendance/studentSubmitList?id=" + id,
    method: "get",
  });
}

// 获取事由列表
export function getLeaveType() {
  return request({
    url: studentUrl + "/study/student/attendance/getLeaveReason",
    method: "get",
  });
}
